-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compare groups case-insensitively at login time #3240
Conversation
case-insensitive but preserving.
All test changes pass (and fail on the previous code). |
@@ -84,6 +84,11 @@ func (b *backend) Login(req *logical.Request, username string, password string) | |||
var allGroups []string | |||
// Import the custom added groups from okta backend | |||
user, err := b.User(req.Storage, username) | |||
if err != nil { | |||
if b.Logger().IsDebug() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort of unrelated, but why do we need to check the logger's level? Does it not respect the level set with SetLevel()
so that logger.Debug()
doesn't print if the logger is set at a higher level?
case-insensitive. New groups will be written in lowercase.
return nil, "", err | ||
} | ||
for _, groupName := range entries { | ||
if strings.ToLower(groupName) == strings.ToLower(n) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just look at group/+ strings.ToLower(n)
and avoid looking at all the entries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will only get us one possible capitalization. So if you have written "GroupFoo" before and now try to write "Groupfoo", you won't find it. With the current logic, you will.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, got it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Okta groups case-insensitive but preserving.